/*
 * WorldManager.h
 *
 *  Created on: 2009/03/04
 *      Author: Yongshik Cho
 */

#ifndef WORLDMANAGER_H_
#define WORLDMANAGER_H_

#include <vector>
#include "core/ISingleton.h"
#include "core/Vector2D.h"
#include "World.h"
#include "sqplus/sqplus.h"
using namespace SqPlus;


class WorldManager : public ISingleton<WorldManager>
{
public:
	static const Vector2D _DEFAULT_GRAVITY;

public:
	WorldManager();
	virtual ~WorldManager();

public:
	static WorldManager& GetInstance()
	{
		assert(m_pInstance);
		return *m_pInstance;
	}
	static WorldManager* GetInstancePtr()
	{
		return m_pInstance;
	}

public:
	const uint32 getWorldCount() { return (uint32)mWorlds.size(); }
	World* getWorld(uint32 index = 0);
	void addWorld(World* world);

	void tick();

private:
	vector<World*>	mWorlds;
	uint32			mInitTime;

};

//must be declared here
DECLARE_INSTANCE_TYPE(WorldManager)

#endif /* WORLDMANAGER_H_ */
